import Vue from 'vue'
import modal from './confirm.vue'
const VueComponent = Vue.extend(modal);
const vm = new VueComponent().$mount();
let init = false;
let defaultOptions = {
    noBtnText: "取消",
    yesBtnText: "确定",
    html: false,
    type: 'confirm',
    maskClosable: true,
    closable: true
};

const confirm = function (options) {
Object.assign(vm,defaultOptions , options);

if (!init) {
    document.body.appendChild(vm.$el);
    init = true;
}

return vm.confirm();
};

export default confirm;